#ifndef __GPRS_H__
#define __GPRS_H__
#include "esp_common.h"



typedef enum
{
	GSM_SIM800C = 1,
	GSM_AIR208S = 2
}GSMTypeDef;

typedef enum
{
	GSM_IS_WORK = (0x01 << 0),//GSM工作
	GSM_IS_CONN = (0X01 << 1),//GSM链接网络
}GSMWorkStatusDef;



#define GSM_READ_LEN                  (544)


typedef enum
{
  GPRS_Net_Connect = 1,
  GPRS_Net_Break,
  GPRS_Send_Http,
  GPRS_Interior_Http,
  GPRS_Init,
  GPRS_CSQ,
  GPRS_Close,
}GPRSCmdDef;

typedef struct 
{
  int cmd;
  int mode;
  unsigned char *sendbuf;
  unsigned char *recvbuf;//第一个字节存放发送结果
  long       recvSize; //接收到下
  //rt_sem_t   *finsh;		
  void *data;         //某些命令下的特殊数据
}GPRSMailDef;



s8_t gprs_module_start(s8_t *curCsq,u8_t mode);
void gprs_module_stop(void);
s8_t gsm_gprs_connect(int cmd,char *url,int port,int wait);
STATUS gprs_connet_resend(s8_t (*fun)(int ,char *,int ,int),int cmd,char *url,int port,int wait);
s8_t send_tcp_data(u8_t *sBuf,u16_t ssize,u8_t *rBuf,u16_t *rlen,u16_t delay);
s8_t rsend_tcp_data(u8_t *sBuf,u16_t ssize,u8_t *rBuf,u16_t *rlen,u16_t delay);
void ICACHE_FLASH_ATTR ota_start_Upgrade(const char *server_ip, uint16_t port,const char *path);


#endif
